<?php

class Application_Model_service_BanTinService implements Application_Model_serviceInf_BanTinServiceInf {
	/**
	 * 
	 */
	
	protected static $_instance = null;
	protected function __construct() {
	
	}
	public static function getInstance() {
		if (self::$_instance == null) {
			self::$_instance = new self ();
		}
		return self::$_instance;
	}
	
	protected $_name = "tb_bantin";
	
	public function getAllBanTin() {
		$banTinDAO = new Application_Model_dataDAO_BanTinDAO ();
		$kq = $banTinDAO->getAllBanTin ();
		
		return $kq;
	}
	
	/**
	 * @param unknown_type $idBanTin
	 */
	public function getBanTin($idBanTin) {
		$banTinDAO = new Application_Model_dataDAO_BanTinDAO ();
		$kq = $banTinDAO->getBanTin ( $idBanTin );
		
		return $kq;
	}
	
	/**
	 * 
	 */
	public function getTopBanTin() {
		$banTinDAO = new Application_Model_dataDAO_BanTinDAO ();
		return $banTinDAO->getTopBanTin();
	}
	
	/**
	 * 
	 */
	
	/**
	 * @param unknown_type $maDanhMuc
	 */
	public function getBanTinTheoDanhMuc($maDanhMuc) {
		$banTinDAO = new Application_Model_dataDAO_BanTinDAO ();
		return $banTinDAO->getBanTinTheoDanhMuc($maDanhMuc);
	}

	public function addBanTin($tieuDe, $tab, $noiDung, $hinhKemBanTin, $maDanhMucBanTin, $maTaiKhoan ) {
		$banTinDAO =Application_Model_dataDAO_BanTinDAO::getInstance();
		$banTinDAO instanceof Application_Model_dataDAO_BanTinDAO;
		$result = $banTinDAO->addBanTin($tieuDe, $tab, $noiDung, $hinhKemBanTin, $maDanhMucBanTin, $maTaiKhoan );
		return $result;
	}

/**
	 * @param unknown_type $array
	 */
	public function editBanTin($maBanTin,$tieuDe,$tab,$noiDung,$hinhKemBanTin,$maDanhMucBanTin,$maTaiKhoan) {
		$banTinDAO = Application_Model_dataDAO_BanTinDAO::getInstance();
		$banTinDAO instanceof Application_Model_dataDAO_BanTinDAO;
		$result = $banTinDAO->editBanTin($maBanTin,$tieuDe,$tab,$noiDung,$hinhKemBanTin,$maDanhMucBanTin,$maTaiKhoan);
		return $result;
	}

/**
	 * @param unknown_type $idBanTin
	 */
	public function deleteBanTin($idBanTin) {
		$banTinDAO = Application_Model_dataDAO_BanTinDAO::getInstance();
		return $banTinDAO->deleteBanTin($idBanTin);
	}


}

?>